<template>
    <div>
        <level1Tabs
            :typeList="typeList"
            :list="list"
            :page="pageSet"
            :loading="loading"
            @selected="selectThisImg"
            @handleClick="handleTabClick"
            @close="close"
            @pageChange="handlePageChange"
        ></level1Tabs>
    </div>
</template>

<script>
import level1Tabs from './level1Tabs';
import bgImage from '../../../../../assets/imgs/fj.jpg'

export default {
    components: {
        level1Tabs,
    },
    props: {
        pageSize: {
            type: Number,
            default: 10,
        },
    },
    data() {
        return {
            typeList: [
                { name: '粒子', id: '1'},
            ],
            list: [
              
            ],
            pageSet: {
                pageIndex: 1,
                pageSize: this.pageSize,
                totalPage: 0,
            },
            loading: false,
        };
    },
    created(){
      this.fetchCurData(1)
    },
    methods: {
        //  获取子类
        fetchTypes() {},
        // 获取特效素材
        fetchCurData(type) {
          var para = {
            type : type
          }
          this.$api.get("/effect",para,res=>{
            console.log('res :', res);
            res.forEach(item=>{
              item.url = item.bgUrl;
            })
            this.list = res

          },err=>{
            this.$message.error(err)
          })
        },
        // 子类切换触发
        handleTabClick(tab) {
          console.log('tab :', tab);
          this.fetchCurData(Number(tab.name))
        },
        // 分页切花触发
        handlePageChange() {},
        // 选择触发
        selectThisImg(data) {
            console.log('data :', data);
            this.$emit('selected', data);
        },
        close() {
            this.$emit('close');
        },
    },
};
</script>

<style lang="scss" scoped>
</style>